﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OrderManagement;
namespace OrderWinForm
{
    public partial class ModifyOrder : Form
    {
        public ModifyOrder(Form1 form,Order Current)
        {
            InitializeComponent();
            this.form1 = form;
            this.order = Current;
            C_name.DataBindings.Add("Text", order.Customer, "Name");
            Address.DataBindings.Add("Text", order.Customer, "Address");
            Phone.DataBindings.Add("Text", order.Customer, "Phone");
            C_ID.DataBindings.Add("Text", order, "ID");
            bindingSource1.DataSource = Current.OrderDetails.goods;
            form.Order_bindingSource.Remove(Current);
            
        }
        private Form1 form1=new Form1();
       // private Order Current
        //private Customers customer = new Customers();
        //private String OrderID = "";
        //private List<Goods> goods = new List<Goods>();
        private Order order;
        private void Confirm_button_Click(object sender, EventArgs e)
        {
            
            //order.OrderDetails.goods.Add(new Goods(Gname.Text, Convert.ToDouble(Price.Text), Convert.ToInt32(Period.Text), Convert.ToInt32(Num.Text)));
            //OrderDetails details = new OrderDetails(this.goods);
            Order neworder = this.order;
            //form1.service.AddOrder(neworder);   
            form1.Order_bindingSource.Add(neworder);
            //form1.Order_bindingSource.Remove()
            this.Close();
            
        }
    }
}
